package com.itheima.web.controller;

import com.itheima.util.OssUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Controller
@RequestMapping("/file")
public class FileController {

@ResponseBody
@RequestMapping("/upload")
public String uploadFile(MultipartFile uploadFile) throws IOException {
    String url= OssUtil.upload(uploadFile.getOriginalFilename(),uploadFile.getInputStream());
    return url;

}

}
